<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const properties = [
            "中华园,北京市,公寓",
            "华景苑,上海市,别墅",
            "新城市广场,深圳市,公寓",
            "雅居乐花园,广州市,别墅",
            "恒大城,广州市,公寓",
            "太阳花园,北京市,别墅"
        ];

        function getHouse(data) {
            const newArr = data.map(item => item.split(','))
            console.log(newArr);
            const obj = {}
            newArr.forEach(([houseName, , houseType]) => {
                // 判断对象里有没有房屋类型
                if (obj[houseType]) {
                    obj[houseType].push(houseName)
                } else {
                   // 新增对象
                    obj[houseType] = []
                    obj[houseType].push(houseName)
                }
            });
            console.log(obj);

        }
        getHouse(properties)
    </script>
</body>

</html>